package org.example.batchutils.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.concurrent.*;

@Configuration
public class ThreadPoolConfig {

    @Bean("threadPoolExecutor")
    public ExecutorService threadPoolExecutorConfig() {
        return  new ThreadPoolExecutor(5, 10, 1000,
                TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(10), Executors.defaultThreadFactory() ,new ThreadPoolExecutor.AbortPolicy());
    }
}
